'use strict'


import Http from '../kit/HttpKit'
import Api from './Api'

const URL_LIST = Api.API_URL + '/procurement/list'
const URL_DELETE = Api.API_URL + '/procurement/delete'

const URL_CHECK_STATUS_PASS = Api.API_URL + '/procurement/checkStatusPass'
const URL_CHECK_STATUS_FAIL = Api.API_URL + '/procurement/checkStatusFail'

const URL_PUSH = Api.API_URL + '/procurement/push'
const URL_RECALL_PUSH = Api.API_URL + '/procurement/recallPush'
const URL_PUSH_LIST = Api.API_URL + '/procurement/pushList'

const URL_END = Api.API_URL + '/procurement/end'


/**
* 采购信息模块
**/
const list = (data, callback)=>{
	var url = Api.API_URL + '/procurement/list';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const detail = (procurementId, callback)=>{
	var url = Api.API_URL + '/procurement/detail';

	let data = {id: procurementId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const pushList = (data, callback)=>{
	var url = Api.API_URL + '/procurement/pushList';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

export default{
	list, detail, pushList,
	URL_LIST, URL_DELETE, URL_CHECK_STATUS_PASS, URL_CHECK_STATUS_FAIL, URL_PUSH,URL_RECALL_PUSH, URL_PUSH_LIST, URL_END
}
